/**
 * Created with IntelliJ IDEA.
 * User: aermakov
 * Date: 24.05.13
 * Time: 13:17
 * To change this template use File | Settings | File Templates.
 */

Ext.ns('GrailsCompany.form');

GrailsCompany.form.EmployeeForm = Ext.extend(GrailsCompany.form.CRUDFormPanel, {
    constructor: function (config) {
        config = Ext.apply({
            items: [
                {
                    xtype: 'hidden',
                    name: 'id',
                    width: 150
                },
                {
                    fieldLabel: 'First Name',
                    name: 'firstName',
                    allowBlank: false,
                    width: 150
                },
                {
                    fieldLabel: 'Last Name',
                    name: 'lastName',
                    allowBlank: false,
                    width: 150
                },
                {
                    fieldLabel: 'Email',
                    name: 'emailAddress',
                    allowBlank: false,
                    vtype: 'email',
                    itemId: 'emailAddress',
                    width: 150
                },
                {
                    fieldLabel: 'Account ID',
                    name: 'accountName',
                    allowBlank: false,
                    width: 150
                }
            ]
        }, config);

        GrailsCompany.form.EmployeeForm.superclass.constructor.call(this, config);

        if (this.action === 'create') {
            this.remove('emailAddress');
        }
    }
});
Ext.reg('employeeform', GrailsCompany.form.EmployeeForm);
